const arr = [66, 88, 12, 87, 100, 5, 566, 23]

const selectionSort = (arr) => {
  for (let i = 0; i < arr.length; i++) {
    let min = i
    for (let j = i + 1; j < arr.length; j++) {
      if (arr[j] < arr[min]) {
        min = j
      }
    }
    if (i === min) {
      continue
    }
    const temp = arr[i]
    arr[i] = arr[min]
    arr[min] = temp
  }
}

selectionSort(arr)

console.log(arr);
